local function Injectatlas(ingredients, amount)
    local atlas = 'images/inventoryimages/' .. ingredients .. '.xml'
    return Ingredient(ingredients, amount, atlas)
end
local function Injectproductimg(product)
    local atlas = 'images/inventoryimages/' .. product .. '.xml'
    return atlas
end
--给MOD物品添加一个分类
AddRecipeFilter({
    name = 'DORO_TAB',
    atlas = 'images/map_icons/doro.xml',
    image = 'doro.tex'
})
STRINGS.UI.CRAFTING_FILTERS.DORO_TAB = 'DORO'
-- STRINGS.UI.CRAFTING_FILTERS.EXAMPLE_TAB = '样本制作分类'
local weapon_difficulty = GetModConfigData("weapon_difficulty")
local ingredients = weapon_difficulty == 1 and
    { --简单1个大肉汤，1个齿轮，11个月石，1个巨鹿眼球，1个远古守卫者角，1纯粹恐惧，1个黄宝石，1个绿宝石，1个彩虹宝石，1个紫宝石
        Ingredient(string.lower("BONESTEW"), 1), Ingredient(string.lower("GEARS"), 1),
        Ingredient(string.lower("MOONROCKNUGGET"), 11), Ingredient(string.lower("DEERCLOPS_EYEBALL"), 1),
        Ingredient(string.lower("minotaurhorn"), 1), Ingredient(string.lower("HORRORFUEL"), 1),
        Ingredient(string.lower("YELLOWGEM"), 1), Ingredient(string.lower("GREENGEM"), 1),
        Ingredient(string.lower("OPALPRECIOUSGEM"), 1), Ingredient(string.lower("PURPLEGEM"), 1),
    }
    or weapon_difficulty == 2 and
    { --默认普通制作难度1000个彩虹宝石
        Ingredient(string.lower("OPALPRECIOUSGEM"), 1000),
    }
    or { --困难1000个大肉汤，500个齿轮，1000个月石 500个纯粹恐惧500个纯粹辉煌500个绝望石500个玻璃500个彩虹宝石
        Ingredient(string.lower("BONESTEW"), 1000), Ingredient(string.lower("GEARS"), 500),
        Ingredient(string.lower("MOONROCKNUGGET"), 1000),
        Ingredient(string.lower("HORRORFUEL"), 500), Ingredient(string.lower("PUREBRILLIANCE"), 500),
        Ingredient(string.lower("DREADSTONE"), 500),
        Ingredient(string.lower("MOONGLASS_ROCK"), 500),
        Ingredient(string.lower("OPALPRECIOUSGEM"), 500),
    }
local recipe_all = {
    {
        recipe_name = 'doro_weapon_shadow',
        ingredients = ingredients,
        tech = TECH.MAGIC_THREE,
        isOriginalItem = true,
        isShown = true,
        config = {
            builder_tag = "doro",
            product = string.lower("doro_weapon_shadow"),
            numtogive = 1,
        },
        filters = { 'CHARACTER', 'WEAPONS', 'DORO_TAB' }
    },
    {
        recipe_name = 'doro_orange_bush_item',
        ingredients = { --2金块4蜂蜜6浆果
            Ingredient(string.lower("GOLDNUGGET"), 2), Ingredient(string.lower("HONEY"), 4),
            Ingredient(string.lower("berries"), 6),
        },
        tech = TECH.NONE,
        isOriginalItem = true,
        isShown = true,
        config = {
            builder_tag = "doro",
            product = string.lower("doro_orange_bush_item"),
            numtogive = 1,
            atlas = GetInventoryItemAtlas('dug_berrybush_juicy.tex'),
            image = 'dug_berrybush_juicy.tex'
        },
        filters = { 'CHARACTER', 'DORO_TAB' }
    },
    --doro_orange_hat
    {
        recipe_name = 'doro_orange_hat',
        ingredients = { --2熊皮4彩虹宝石6纯粹辉煌6绝望石40个哦润吉，科学一本
            Ingredient(string.lower("BEARGER_FUR"), 2), Ingredient(string.lower("OPALPRECIOUSGEM"), 4),
            Ingredient(string.lower("PUREBRILLIANCE"), 6), Ingredient(string.lower("DREADSTONE"), 6),
            Ingredient(string.lower("doro_orange"), 40),
        },
        tech = TECH.SCIENCE_ONE,
        isOriginalItem = true,
        isShown = true,
        config = {
            builder_tag = "doro",
            product = string.lower("doro_orange_hat"),
            numtogive = 1,
        },
        filters = { 'CHARACTER', 'DORO_TAB' }
    },
    --FAVORITES--收藏
    --CRAFTING_STATION--科技站专属
    --SPECIAL_EVENT--特殊节日
    --MODS--模组物品(所有非科技站解锁的mod物品会自动添加这个标签)

    --CHARACTER--人物专属
    --TOOLS--工具
    --LIGHT--光源
    --PROTOTYPERS--科技
    --REFINE--精炼
    --WEAPONS--武器
    --ARMOUR--盔甲
    --CLOTHING--服装
    --RESTORATION--治疗
    --MAGIC--魔法
    --DECOR--装饰

    --STRUCTURES--建筑
    --CONTAINERS--容器
    --COOKING--烹饪
    --GARDENING--食物、种植
    --FISHING--钓鱼
    --SEAFARING--航海
    --RIDING--骑乘
    --WINTER--保暖道具
    --SUMMER--避暑道具
    --RAIN--雨具
    --EVERYTHING--所有
}

for k, _r in pairs(recipe_all) do
    if _r.isOriginalItem == nil then
        if _r.config == nil then
            _r.config = {}
        end
        if _r.config.atlas == nil then
            if _r.config.product ~= nil then
                _r.config.atlas = Injectproductimg(_r.config.product)
                _r.config.image = _r.config.product .. '.tex'
            else
                _r.config.atlas = Injectproductimg(_r.recipe_name)
                _r.config.image = _r.recipe_name .. '.tex'
            end
        end
    end
    if _r.filters == nil then
        _r.filters = { 'EXAMPLE_TAB' }
    end
    if _r.config == nil then
        _r.config = {}
    end
    if _r.isShown == nil or _r.isShown == true then
        AddRecipe2(_r.recipe_name, _r.ingredients, _r.tech, _r.config, _r.filters)
    end
end
